#include <modules\input\input_module.h>

namespace DelGE
{
	namespace Modules
	{
		namespace Input
		{
			InputModule::InputModule()
			{
				this->sName = "Input";

				LoadModule();
			}

			InputModule::~InputModule()
			{
				UnloadModule();
			}

			void InputModule::LoadModule()
			{
				#if defined(DELGE_PLATFORM_WIN32)
				this->pWin32_Interface = new Win32InputInterface();
				this->SetInterface(this->pWin32_Interface);
				#endif
			}

			void InputModule::UnloadModule()
			{
				#if defined(DELGE_PLATFORM_WIN32)
				delete this->pWin32_Interface;
				#endif
			}

			void InputModule::HandleMessages()
			{
			}

			#if defined(DELGE_PLATFORM_WIN32)
			Win32InputInterface* InputModule::GetInterface_Win32()
			{
				return this->pWin32_Interface;
			}
			#endif

			/*void InputModule::SetSystemHandle(SystemModule* pSystem)
			{
				((InputInterface*)this->pInterface)->SetSystemHandle(pSystem);
			}

			SystemModule* InputModule::GetSystemHandle()
			{
				return ((InputInterface*)this->pInterface)->GetSystemHandle();
			}*/

			bool InputModule::IsKeyUp(KeyCode key)
			{
				return ((InputInterface*)this->pInterface)->IsKeyUp(key);
			}

			bool InputModule::IsKeyDown(KeyCode key)
			{
				return ((InputInterface*)this->pInterface)->IsKeyDown(key);
			}

			bool InputModule::IsKeyHit(KeyCode key)
			{
				return ((InputInterface*)this->pInterface)->IsKeyHit(key);
			}

			bool InputModule::IsKeyPressed(KeyCode key)
			{
				return ((InputInterface*)this->pInterface)->IsKeyPressed(key);
			}

			bool InputModule::IsMouseButtonUp(MouseCode button)
			{
				return ((InputInterface*)this->pInterface)->IsMouseButtonUp(button);
			}

			bool InputModule::IsMouseButtonDown(MouseCode button)
			{
				return ((InputInterface*)this->pInterface)->IsMouseButtonDown(button);
			}

			bool InputModule::IsMouseButtonHit(MouseCode button)
			{
				return ((InputInterface*)this->pInterface)->IsMouseButtonHit(button);
			}

			bool InputModule::IsMouseButtonPressed(MouseCode button)
			{
				return ((InputInterface*)this->pInterface)->IsMouseButtonPressed(button);
			}

			int InputModule::GetMouseX()
			{
				return ((InputInterface*)this->pInterface)->GetMouseX();
			}

			int InputModule::GetMouseY()
			{
				return ((InputInterface*)this->pInterface)->GetMouseY();
			}

			void InputModule::SetMousePosition(int iMouseX, int iMouseY)
			{
				((InputInterface*)this->pInterface)->SetMousePosition(iMouseX, iMouseY);
			}

			void InputModule::Update()
			{
				((InputInterface*)this->pInterface)->Update();
			}
		}
	}
}